﻿package mortal.game.view.copy.GroupTowerCopy
{
    import Message.Public.*;
    import extend.language.*;
    import flash.utils.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.view.copy.GroupTowerCopy.data.*;

    public class GroupTowerCahe extends Object
    {
        private var _hurtArr:Array;
        public var towerInfo:SGroupTowerMsg;
        public var passInfo:SGroupTowerPassMsg;
        public var endInfo:SGroupTowerEndMsg;
        public var isEnd:Boolean = false;
        public var singleGanInfo:STowerCopy4PanelInfo;
        public var singleFtRwDic:Dictionary;
        public var singleFtRwArr:Array;
        public var singleTowerInfo:STowerCopy4Msg;
        public var singleEndInfo:STowerCopy4EndMsg;

        public function GroupTowerCahe()
        {
            this.singleFtRwDic = new Dictionary();
            return;
        }// end function

        public function get hurtArr() : Array
        {
            return this._hurtArr;
        }// end function

        public function set hurtArr(param1:Array) : void
        {
            this._hurtArr = param1;
            this._hurtArr.sort(this.sortHurt);
            return;
        }// end function

        private function sortHurt(param1:SGroupTowerPlayerHurtInfo, param2:SGroupTowerPlayerHurtInfo) : int
        {
            if (param1.hurt > param2.hurt)
            {
                return -1;
            }
            if (param1.hurt < param2.hurt)
            {
                return 1;
            }
            return 0;
        }// end function

        public function getHasFinishAllPass(param1:int = 0) : Boolean
        {
            if (this.towerInfo && this.towerInfo.result && GroupTowerCopyUtil.TotalLevel == this.towerInfo.level)
            {
                return true;
            }
            return false;
        }// end function

        public function get allowPassTo() : Boolean
        {
            var _loc_1:int = 0;
            if (this.towerInfo != null)
            {
                if (this.towerInfo.result)
                {
                    return true;
                }
                _loc_1 = Cache.instance.copy.copyInfo.code;
                if (GroupTowerCopyUtil.getCurMapLevel(_loc_1) < this.towerInfo.level)
                {
                    return true;
                }
                MsgManager.showRollTipsMsg("" + Language.getString(70929));
                return false;
            }
            return false;
        }// end function

        public function initSingleFtRw(param1:int, param2:Dictionary) : void
        {
            this.singleFtRwDic[param1] = param2;
            return;
        }// end function

        public function updateFirstRwState(param1:int, param2:int) : void
        {
            var _loc_3:* = this.singleFtRwDic[param1];
            if (_loc_3)
            {
                _loc_3[param2] = true;
            }
            return;
        }// end function

    }
}
